﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LIMS.BLL
{
    /// <summary>
    /// 新闻综合管理
    /// </summary>
    public class NewsInfoManager
    {

        private static LIMS.IDAL.INewsInfo newsInfo = DALFactory.DataAccess<LIMS.IDAL.INewsInfo>.CreateObject();

        public static Boolean AddNewsInfo(LIMS.Model.NewsInfos info)
        {
            return newsInfo.Add(info);
        }

        public static List<LIMS.Model.NewsInfos> GetAllNews()
        {
            return newsInfo.FindAll();
        }

        public static List<LIMS.Model.NewsInfos> GetNewsByType(String newsTypeCode)
        {
            if (newsTypeCode == "-1")  //查找所有类别
            {
                return GetAllNews();
            }
            else if (newsTypeCode == "1")  //查找紧急通知
            {
                return newsInfo.FindByType(true);
            }
            return newsInfo.FindByType(false); //查找普通通知
        }

        public static Boolean UpdateNewsInfo(LIMS.Model.NewsInfos info)
        {
            return newsInfo.Modify(info);
        }

        public static Int32 TotalCount()
        {
            return newsInfo.Count();
        }

        public static List<LIMS.Model.NewsInfos> SearchByTitle(string title)
        {
            return newsInfo.FindByTitle(title);
        }

    }
}
